<%--
  Created by IntelliJ IDEA.
  User: USER
  Date: 2021.07.11
  Time: 22:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>${genres.name}</title>
    <link rel="stylesheet" href="/layui/css/layui.css">
</head>
<body>
<div class="layui-container">
    <div class="layui-row">
        <a href="/">首页</a>
    </div>
    <div class="layui-row layui-col-space15">
        <c:forEach var="book" items="${booksOfGenres}">
        <div class="layui-panel" style="margin: 10px;">
            <div style="padding: 30px;">
                <div class="layui-row">
                    <div class="layui-col-md9">
                        <h2 style="text-align: center">${book.name}</h2>
                        <div>类型：${genres.name}</div>
                        <div>作者：${book.author}</div>
                        <div>字数：${book.wordNumber}</div>
                        <div>添加时间：${book.addTime}</div>
                        <span>小说简介：</span>
                        <pre class="layui-code" style="font-size: medium">${book.description}</pre>
                        <a href="${book.downloadLink}">下载本书</a><br/>
                    </div>
                    <div class="layui-col-md3">
                        <img src="http://localhost/chfs/shared/pics/${book.id}.jpg" width="200px" height="280px"/>
                    </div>
                </div>
            </div>
        </div>
        </c:forEach>
    </div>
    <div id="pages"></div>
</div>
<script src="/layui/layui.js"></script>
<script>
    layui.define(function () {
        const laypage = layui.laypage;
        laypage.render({
            elem: 'pages'
            ,count: ${pageInfo.total}
            ,limit: ${pageInfo.pageSize}
            ,curr: ${pageInfo.curr}
            ,jump: function(obj, first){
                if(!first){
                    location.href='/genres/list.sai?id=${genres.id}&pageNum='+obj.curr+'&pageSize='+${pageInfo.pageSize};
                }
            }
        });
    });
</script>
</body>
</html>
